diff -Naur xye-0.12.0.orig/src/editorsave.cpp xye-0.12.0/src/editorsave.cpp
--- xye-0.12.0.orig/src/editorsave.cpp	2011-10-29 21:57:28.000000000 +0000
+++ xye-0.12.0/src/editorsave.cpp	2012-08-05 10:34:00.131028629 +0000
@@ -662,16 +662,16 @@
         }
         saveColorStuff(file, board);
     
-        int i,j;
+        int j,k;
         file << "\t<ground>\n";
         resetSavedPosition();
-        for (i=0;i<XYE_HORZ;i++) for (j=0;j<XYE_VERT;j++) saveGroundObject(file,editor::board->objects[i][j],i,XYE_VERT-j-1);
+        for (j=0;j<XYE_HORZ;j++) for (k=0;k<XYE_VERT;k++) saveGroundObject(file,editor::board->objects[j][k],j,XYE_VERT-k-1);
         file << "\t</ground>\n";
         file << "\t<objects>\n";
         resetSavedPosition();
-        for (i=0;i<XYE_HORZ;i++) for (j=0;j<XYE_VERT;j++)
+        for (j=0;j<XYE_HORZ;j++) for (k=0;k<XYE_VERT;k++)
         {
-            saveNormalObject(file,editor::board->objects[i][j],i,XYE_VERT-j-1);
+            saveNormalObject(file,editor::board->objects[j][k],j,XYE_VERT-k-1);
         }
         savePortals( file, editor::board);
         
diff -Naur xye-0.12.0.orig/src/gen.cpp xye-0.12.0/src/gen.cpp
--- xye-0.12.0.orig/src/gen.cpp	2011-10-07 19:00:29.000000000 +0000
+++ xye-0.12.0/src/gen.cpp	2012-08-05 10:20:47.652013747 +0000
@@ -21,6 +21,7 @@
 #include<cstdio>
 #include<iostream>
 #include<fstream>
+#include <unistd.h>
 
 const float F_RAND_MAX = (float)(RAND_MAX);
 
